<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: Origami::XFA::ClassMethods</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">Origami::XFA::ClassMethods</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/origami/xfa_rb.html">
                origami/xfa.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000348">mime_type</a>&nbsp;&nbsp;
      <a href="#M000346">xfa_attribute</a>&nbsp;&nbsp;
      <a href="#M000347">xfa_node</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000348" class="method-detail">
        <a name="M000348"></a>

        <div class="method-heading">
          <a href="#M000348" class="method-signature">
          <span class="method-name">mime_type</span><span class="method-args">(type)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000348-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000348-source">
<pre>
    <span class="ruby-comment cmt"># File origami/xfa.rb, line 74</span>
74:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mime_type</span>(<span class="ruby-identifier">type</span>)
75:         <span class="ruby-identifier">send</span>(<span class="ruby-identifier">:define_method</span>, <span class="ruby-value str">&quot;mime_type&quot;</span>) { <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">type</span> }
76:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000346" class="method-detail">
        <a name="M000346"></a>

        <div class="method-heading">
          <a href="#M000346" class="method-signature">
          <span class="method-name">xfa_attribute</span><span class="method-args">(name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000346-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000346-source">
<pre>
    <span class="ruby-comment cmt"># File origami/xfa.rb, line 48</span>
48:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xfa_attribute</span>(<span class="ruby-identifier">name</span>)
49: 
50:         <span class="ruby-identifier">read_xml_attr</span> = <span class="ruby-identifier">lambda</span> { <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>] }
51:         <span class="ruby-identifier">write_xml_attr</span> = <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">value</span> }
52: 
53:         <span class="ruby-identifier">send</span>(<span class="ruby-identifier">:define_method</span>, <span class="ruby-node">&quot;attr_#{name.to_s}&quot;</span>, <span class="ruby-identifier">read_xml_attr</span>)
54:         <span class="ruby-identifier">send</span>(<span class="ruby-identifier">:define_method</span>, <span class="ruby-node">&quot;attr_#{name.to_s}=&quot;</span>, <span class="ruby-identifier">write_xml_attr</span>)
55: 
56:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000347" class="method-detail">
        <a name="M000347"></a>

        <div class="method-heading">
          <a href="#M000347" class="method-signature">
          <span class="method-name">xfa_node</span><span class="method-args">(name, type, range = (0..(1.0/0)))</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000347-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000347-source">
<pre>
    <span class="ruby-comment cmt"># File origami/xfa.rb, line 58</span>
58:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xfa_node</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">type</span>, <span class="ruby-identifier">range</span> = (<span class="ruby-value">0</span><span class="ruby-operator">..</span>(<span class="ruby-value">1.0</span><span class="ruby-operator">/</span><span class="ruby-value">0</span>)))
59:         <span class="ruby-identifier">add_child</span> = <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">attr</span><span class="ruby-operator">|</span>
60:           <span class="ruby-identifier">elt</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">add_element</span>(<span class="ruby-identifier">type</span>.<span class="ruby-identifier">new</span>)
61: 
62:           <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">attr</span>.<span class="ruby-identifier">empty?</span>
63:             <span class="ruby-identifier">attr</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
64:               <span class="ruby-identifier">elt</span>.<span class="ruby-identifier">attributes</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">v</span>
65:             <span class="ruby-keyword kw">end</span>
66:           <span class="ruby-keyword kw">end</span>
67: 
68:           <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">elt</span>
69:         }
70: 
71:         <span class="ruby-identifier">send</span>(<span class="ruby-identifier">:define_method</span>, <span class="ruby-node">&quot;add_#{name}&quot;</span>, <span class="ruby-identifier">add_child</span>)
72:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>